package com.pronosticnews.server.domain.model;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;

import fr.ysa.persistence.Entity;

@javax.persistence.Entity
public class Pays implements Entity {

	private static final long serialVersionUID = -4513508411965911047L;

	public static enum VALUE_NAME {
		id, nom, drapeau
	}

	// constructors
	public Pays() {
		initialize();
	}

	public Pays(java.lang.Long id) {
		this.setId(id);
		initialize();
	}

	public Pays(java.lang.Long id, java.lang.String nom) {

		this.setId(id);
		this.setNom(nom);
		initialize();
	}

	protected void initialize() {
	}

	@Transient
	private int hashCode = Integer.MIN_VALUE;

	// primary key
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private java.lang.Long id;

	// fields
	@Column(unique=true, nullable=false)
	@NotNull
	private java.lang.String nom;

	private Integer drapeau;
	
	public java.lang.Long getId() {
		return id;
	}

	public void setId(java.lang.Long id) {
		this.id = id;
		this.hashCode = Integer.MIN_VALUE;
	}

	public java.lang.String getNom() {
		return nom;
	}

	public void setNom(java.lang.String nom) {
		this.nom = nom;
	}

	public boolean equals(Object obj) {
		if (null == obj)
			return false;
		if (!(obj instanceof Pays))
			return false;
		else {
			Pays pays = (Pays) obj;
			if (null == this.getId() || null == pays.getId())
				return false;
			else
				return (this.getId().equals(pays.getId()));
		}
	}

	public int hashCode() {
		if (Integer.MIN_VALUE == this.hashCode) {
			if (null == this.getId())
				return super.hashCode();
			else {
				String hashStr = this.getClass().getName() + ":"
						+ this.getId().hashCode();
				this.hashCode = hashStr.hashCode();
			}
		}
		return this.hashCode;
	}

	public String toString() {
		return super.toString();
	}

	@Override
	public List<String> getColumnNameValues() {
		List<String> list = new ArrayList<String>();
		for (VALUE_NAME value : VALUE_NAME.values()) {
			list.add(value.name());
		}
		return list;
	}

	public Integer getDrapeau() {
		return drapeau;
	}

	public void setDrapeau(Integer drapeau) {
		this.drapeau = drapeau;
	}

}